'use strict';
app.service('bookingService',['$http','$q','utilService',function($http,$q,utilService){
    var _this_=this;

    _this_.findById=function($scope){
        var deferred = $q.defer();
        utilService.get({
            url:$scope.app.domain + 'booking/'+$scope.id
        }).then(function(response){
            deferred.resolve(response.data);
        },function(e){
            console.error(e);
            deferred.reject("连接服务器出错！");
        })
        return deferred.promise;
    }

    //批量下架
    _this_.confirm= function ($scope) {
        var deferred = $q.defer();
        utilService.api({
            url:$scope.app.domain + 'booking/status/'+$scope.id,
            data:{status:2},
            method:"PUT"
        }).then(function(result){
            deferred.resolve(result);
        });
        return deferred.promise;
    };


}]);
